import sys
from PyQt5.QtWidgets import QApplication, QWidget, QDesktopWidget

app = QApplication(sys.argv)

w = QWidget()
# 设置窗口标题
w.setWindowTitle('fa--*_*--')
# 窗口大小
w.resize(300, 300)
# 将窗口设置在屏幕的左上角(利用坐标)
# w.move(0, 0)
# 调整窗口在屏幕中央显示
# 寻找中心点的坐标
center_pinter = QDesktopWidget().availableGeometry().center()
print(center_pinter)
# 获取坐标x的值
x = center_pinter.x()
# 获取坐标y的值
y = center_pinter.y()
print(x, y)
print(w.frameGeometry())
print(w.frameGeometry().getRect())
# print(type(w.frameGeometry().getRect()))

old_x, old_y, width, height = w.frameGeometry().getRect()
print(old_x, old_y, width, height)
w.move(x - width / 2, y - height / 2)

# 展示窗口
w.show()

# 程序进行循环等待状态
app.exec()
